var RunLayer_02 = BaseLayer02.extend({
	frame:[],
	num:0,
	no:0,
	curSel:null,
	ctor:function (parent) {
		this._super(parent,5);
		this.init();
	},
	init:function () {
		cc.log("耳朵的结构");
		this._super();
		//第一次加载，弹框提示
		this.loadWin();
		this.loadInfo();		
		//加载主图（耳朵）
		this.loadMain();
		//加载右上角人头
		this.loadHead();
		//加载左侧声波
		this.loadSound();
		//加载耳朵分类（外，中，内）
		this.loadJiegou();
		if(gg.teach_type == TAG_REAL){
			//实战模式下，随机一个部位闪烁
			this.loadFlash();
		}				
	},
	loadInfo:function(){
		for(var i in teach_flow02){
			var info = teach_flow02[i];
			if(info.tag == TAG_ERDUO){
				//读取Flow里的任务流
				this.frameInfo = info.frameInfo;
				//复制一个数组，做实战中删除用
				this.frame = this.frameInfo.concat();
			}
		}		
	},
	loadWin:function(){
		if(gg.firstRun){
			gg.synch_l = true;
			var tip = ll.tip.getChildByTag(TAG_TIP);
			tip.setEnable(false);
			var back = ll.tip.getChildByTag(TAG_CLOSE);
			back.setEnable(false);
			var win = new WinFrame(ll.tip,3,"点击右侧结构名称");
			win.open2();
			gg.firstRun = false;
		}					
	},
	loadMain:function(){
		//耳朵主图
		this.body = new cc.Sprite("#erduo/body.png");
		this.body.setPosition(cc.p(gg.width*0.39, gg.height*0.39));
		if(gg.teach_type == TAG_REAL){
			this.body.setOpacity(50);
		}else {
			this.body.setOpacity(255);
		}
		this.addChild(this.body);
		var bw = this.body.width;
		var bh = this.body.height;
		for(var i in this.frameInfo){
			var info = this.frameInfo[i];	
			if(!gg.flow.over_flag){
				info.finish = false;
				info.doRight = false;
			}
			var bt = new Button(this.body,10,info.tag,info.img,this.callback,this);
			bt.setPosition(cc.p(info.px, info.py));
			bt.setAnchorPoint(0,1);
			bt.setOpacity(1);
			bt.info = info;
		}				
		//加载名称
		this.loadTipFrame();
	},
	loadHead:function(){
		//加载右上角人头
		var head = new cc.Sprite("#erduo/head.png");
		this.addChild(head);
		head.setPosition(cc.p(867,500));
		//人头上方文字
		var head_word = new cc.LabelTTF("大脑（产生听觉）",gg.fontName,gg.fontSize2);
		head.addChild(head_word);
		head_word.setPosition(cc.p(100,200));
		//指向人头的箭头（神经传导）
		var line = new cc.Sprite("#erduo/line1.png");
		head.addChild(line);
		line.setPosition(cc.p(68,41));
		line.setScale(0.9);
	},
	loadJiegou:function(){
		//加载文字（外耳，中耳，内耳）
		var line1 = new cc.Sprite("#erduo/line.png");
		this.addChild(line1);
		line1.setPosition(cc.p(550,460));
		var line2 = new cc.Sprite("#erduo/line.png");
		this.addChild(line2);
		line2.setPosition(cc.p(605,460));
		
		var word1 = new cc.LabelTTF("外\n耳",gg.fontName,gg.fontSize2);
		this.addChild(word1);
		word1.setPosition(cc.p(515,540));
		var word2 = new cc.LabelTTF("中\n耳",gg.fontName,gg.fontSize2);
		this.addChild(word2);
		word2.setPosition(cc.p(567,540));
		var word3 = new cc.LabelTTF("内\n耳",gg.fontName,gg.fontSize2);
		this.addChild(word3);
		word3.setPosition(cc.p(619,540));
	},
	loadSound:function(){
//		//加载左侧声波
//		var sound = new cc.Sprite("#erduo/sound.png");
//		this.addChild(sound);
//		sound.setPosition(cc.p(130,300));
//		sound.setScale(0.8);
//		//声波名字
//		var sound_word = new cc.LabelTTF("声波",gg.fontName,gg.fontSize2/0.8);
//		sound.addChild(sound_word);
//		sound_word.setPosition(cc.p(315,266));
	},
	callback:function (p){
		this.body.setOpacity(50);
		switch (p.getTag()) {
		case TAG_ERDUO_ERKUO:
		case TAG_ERDUO_BANGUIGUAN:
		case TAG_ERDUO_ERWO:
		case TAG_ERDUO_GUMO:
		case TAG_ERDUO_GUSHI:
		case TAG_ERDUO_QIANTING:
		case TAG_ERDUO_TINGSHENJING:
		case TAG_ERDUO_TINGXIAOGU:
		case TAG_ERDUO_WAIERDAO:	
		case TAG_ERDUO_YANGUGUAN:	
			this.clickCheck(p);						
			break;			
		default:
			break;
		}
		if(gg.teach_type == TAG_REAL){
			if(!gg.flow.over_flag){
				if(gg.succeed_erduo){			
					this.runAction(cc.sequence(cc.delayTime(1),cc.callFunc(function() {
						gg.flow.next();
					}, this)));		
				}
			}
		}	
	},
	destroy:function(){
		this._super();
	},
	onExit:function(){
		this._super();
	}
});